package cn.hive.lianxi;

import org.apache.commons.codec.digest.DigestUtils;
import org.apache.hadoop.hive.ql.exec.UDF;

public class Udf_01_md5 extends UDF {

	public String evaluate(String text) {

		if (text == null || text.trim().length() == 0) {
			return null;
		}
		return md5(text);
	}

	public static String md5(String key) {
		// 加密后的字符串
		String encodeStr = DigestUtils.md5Hex(key);
		return encodeStr;
	}
}
